package com.yld.oa.department.service.impl;

import java.util.List;

import com.yld.oa.department.dao.DepartmentDao;
import com.yld.oa.department.dao.impl.DepartmentDaoImpl;
import com.yld.oa.department.entity.DepartmentEntity;
import com.yld.oa.department.service.DepartmentService;
import com.yld.oa.employee.dao.EmployeeDao;
import com.yld.oa.employee.dao.impl.EmployeeDaoImpl;
import com.yld.oa.employee.entity.EmployeeEntity;

public class DepartmentServiceImpl implements DepartmentService{
	
	private EmployeeDao employeeDao= new EmployeeDaoImpl();
	
	private DepartmentDao  departmentDao= new DepartmentDaoImpl();

	@Override
	public DepartmentEntity findById(Integer id) {
		//编程2个简单的查询
		
		//department 没有员工的信息
		DepartmentEntity department = departmentDao.findById(id);
		
		
		List<EmployeeEntity> emps = employeeDao.findByDepartmentId(id);
		
		
		department.setEmployees(emps);
		
		return department;
	}

}
